package com.xinchuang.utils;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.xinchuang.domain.entity.TestModelMainTable;
import com.xinchuang.domain.entity.TestModelParam;
import com.xinchuang.domain.entity.TestModelSubTable;
import com.xinchuang.domain.entity.TestNoticeMainTabale;
import com.xinchuang.domain.pojo.TestNoticeConsumableTable;
import com.xinchuang.domain.pojo.TestNoticeExceptionTimeTable;
import com.xinchuang.domain.pojo.TestNoticeProductionProcessTable;
import com.xinchuang.domain.pojo.TestNoticeProductionTypeTable;
import com.xinchuang.domain.vo.TestModelParamToVo;
import com.xinchuang.entity.Edtion;
import com.xinchuang.entity.EdtionNotice;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.Objects;

/**
 * TODO
 *
 * @author zkwczx
 * @version 1.0
 * @date 1013/10/31 11:17
 */
public class EdtionVerity {


    public static List<Edtion> updateMoldEdtion(TestModelParamToVo vo, TestModelParam one, int vs, String userId) {
        List<Edtion> list = Lists.newArrayList();
        if (null != vo.getMoldName() && !vo.getMoldName().equals(one.getMoldName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldName");
            edtion.setKeyValue("名称");
            edtion.setBaseValue(one.getMoldName());
            edtion.setUpdateValue(vo.getMoldName());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getMoldLook() && !vo.getMoldLook().equals(one.getMoldLook())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldLook");
            edtion.setKeyValue("模具外形");
            edtion.setBaseValue(one.getMoldLook());
            edtion.setUpdateValue(vo.getMoldLook());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getTemperatureControlTime() && !vo.getTemperatureControlTime().equals(one.getTemperatureControlTime())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("temperatureControlTime");
            edtion.setKeyValue("几点温控");
            edtion.setBaseValue(one.getTemperatureControlTime());
            edtion.setUpdateValue(vo.getTemperatureControlTime());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getPourTime()
                && !vo.getPourTime().equals(one.getPourTime())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("pourTime");
            edtion.setKeyValue("几点浇注");
            edtion.setBaseValue(one.getPourTime());
            edtion.setUpdateValue(vo.getPourTime());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getHotSpotPairType()
                && !vo.getHotSpotPairType().equals(one.getHotSpotPairType())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("hotSpotPairType");
            edtion.setKeyValue("热电偶型号");
            edtion.setBaseValue(one.getHotSpotPairType());
            edtion.setUpdateValue(vo.getHotSpotPairType());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getNeedHydraumaticStation()
                && !vo.getNeedHydraumaticStation().equals(one.getNeedHydraumaticStation())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("needHydraumaticStation");
            edtion.setKeyValue("是否需要液压工作站");
            edtion.setBaseValue(one.getNeedHydraumaticStation());
            edtion.setUpdateValue(vo.getNeedHydraumaticStation());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getInjectionMoldingTime()
                && !vo.getInjectionMoldingTime().equals(one.getInjectionMoldingTime())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("injectionMoldingTime");
            edtion.setKeyValue("几点顺序注塑");
            edtion.setBaseValue(one.getInjectionMoldingTime());
            edtion.setUpdateValue(vo.getInjectionMoldingTime());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getHasLimitSwitch()
                && !vo.getHasLimitSwitch().equals(one.getHasLimitSwitch())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("hasLimitSwitch");
            edtion.setKeyValue("是否有限位开关");
            edtion.setBaseValue(one.getHasLimitSwitch());
            edtion.setUpdateValue(vo.getHasLimitSwitch());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getHasTimeRelay()
                && !vo.getHasTimeRelay().equals(one.getHasTimeRelay())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("hasTimeRelay");
            edtion.setKeyValue("是否有时间继电器");
            edtion.setBaseValue(one.getHasTimeRelay());
            edtion.setUpdateValue(vo.getHasTimeRelay());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getMaterials()
                && !vo.getMaterials().equals(one.getMaterials())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("materials");
            edtion.setKeyValue("制件材料");
            edtion.setBaseValue(one.getMaterials());
            edtion.setUpdateValue(vo.getMaterials());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getColor()
                && !vo.getColor().equals(one.getColor())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("color");
            edtion.setKeyValue("制件颜色");
            edtion.setBaseValue(one.getColor());
            edtion.setUpdateValue(vo.getColor());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getSamplePieceWeight()
                && !vo.getSamplePieceWeight().equals(one.getSamplePieceWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("samplePieceWeight");
            edtion.setKeyValue("样件重量");
            edtion.setBaseValue(one.getSamplePieceWeight());
            edtion.setUpdateValue(vo.getSamplePieceWeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getMaterialWeight()
                && !vo.getMaterialWeight().equals(one.getMaterialWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("materialWeight");
            edtion.setKeyValue("材料重量");
            edtion.setBaseValue(one.getMaterialWeight());
            edtion.setUpdateValue(vo.getMaterialWeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getMoldWeight()
                && !vo.getMoldWeight().equals(one.getMoldWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldWeight");
            edtion.setKeyValue("模具重量");
            edtion.setBaseValue(one.getMoldWeight());
            edtion.setUpdateValue(vo.getMoldWeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getProjectName()
                && !vo.getProjectName().equals(one.getProjectName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("projectName");
            edtion.setKeyValue("项目名称");
            edtion.setBaseValue(one.getProjectName());
            edtion.setUpdateValue(vo.getProjectName());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getCustomerMoldId()
                && !vo.getCustomerMoldId().equals(one.getCustomerMoldId())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("customerMoldId");
            edtion.setKeyValue("客户模具编号");
            edtion.setBaseValue(one.getCustomerMoldId());
            edtion.setUpdateValue(vo.getCustomerMoldId());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getProductName()
                && !vo.getProductName().equals(one.getProductName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("productName");
            edtion.setKeyValue("产品名称");
            edtion.setBaseValue(one.getProductName());
            edtion.setUpdateValue(vo.getProductName());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getProductCode()
                && !vo.getProductCode().equals(one.getProductCode())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("productCode");
            edtion.setKeyValue("产品编号");
            edtion.setBaseValue(one.getProductCode());
            edtion.setUpdateValue(vo.getProductCode());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getProductLength()
                && !vo.getProductLength().equals(one.getProductLength())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("productLength");
            edtion.setKeyValue("长");
            edtion.setBaseValue(one.getProductLength());
            edtion.setUpdateValue(vo.getProductLength());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getProductWidth()
                && !vo.getProductWidth().equals(one.getProductWidth())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("productWidth");
            edtion.setKeyValue("宽");
            edtion.setBaseValue(one.getProductWidth());
            edtion.setUpdateValue(vo.getProductWidth());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getProductHeight()
                && !vo.getProductHeight().equals(one.getProductHeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("productHeight");
            edtion.setKeyValue("高");
            edtion.setBaseValue(one.getProductHeight());
            edtion.setUpdateValue(vo.getProductHeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getSurface()
                && !vo.getSurface().equals(one.getSurface())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("surface");
            edtion.setKeyValue("外观要求");
            edtion.setBaseValue(one.getSurface());
            edtion.setUpdateValue(vo.getSurface());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getCavity()
                && !vo.getCavity().equals(one.getCavity())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("cavity");
            edtion.setKeyValue("型腔材质");
            edtion.setBaseValue(one.getCavity());
            edtion.setUpdateValue(vo.getCavity());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getCore()
                && !vo.getCore().equals(one.getCore())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("core");
            edtion.setKeyValue("型芯材质");
            edtion.setBaseValue(one.getCore());
            edtion.setUpdateValue(vo.getCore());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getCavityNum()
                && !vo.getCavityNum().equals(one.getCavityNum())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("cavityNum");
            edtion.setKeyValue("每模腔数");
            edtion.setBaseValue(one.getCavityNum());
            edtion.setUpdateValue(vo.getCavityNum());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getLongevity()
                && !vo.getLongevity().equals(one.getLongevity())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("longevity");
            edtion.setKeyValue("模具寿命（万模）");
            edtion.setBaseValue(one.getLongevity());
            edtion.setUpdateValue(vo.getLongevity());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getPour()
                && !vo.getPour().equals(one.getPour())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("pour");
            edtion.setKeyValue("浇注系统");
            edtion.setBaseValue(one.getPour());
            edtion.setUpdateValue(vo.getPour());
            edtion.setPerson(userId);
            list.add(edtion);
        }
//        if (null != vo.getMachineSize()
//                && !vo.getMachineSize().equals(one.getMachineSize())) {
//            Edtion edtion = new Edtion();
//            edtion.setRed_id(vo.getMoldId());
//            edtion.setEdition("V" + vs);
//            edtion.setKeyName("machineSize");
//            edtion.setKeyValue("机台大小");
//            edtion.setBaseValue(one.getMachineSize());
//            edtion.setUpdateValue(vo.getMachineSize());
//            edtion.setPerson(userId);
//            list.add(edtion);
//        }
        if (null != vo.getMoldingCycle()
                && !vo.getMoldingCycle().equals(one.getMoldingCycle())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldingCycle");
            edtion.setKeyValue("成型周期S");
            edtion.setBaseValue(one.getMoldingCycle());
            edtion.setUpdateValue(vo.getMoldingCycle());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getPickUpWay()
                && !vo.getPickUpWay().equals(one.getPickUpWay())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("pickUpWay");
            edtion.setKeyValue("取件方式");
            edtion.setBaseValue(one.getPickUpWay());
            edtion.setUpdateValue(vo.getPickUpWay());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getEjectionOrresetMode()
                && !vo.getEjectionOrresetMode().equals(one.getEjectionOrresetMode())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("ejectionOrresetMode");
            edtion.setKeyValue("顶出/复位方式");
            edtion.setBaseValue(one.getEjectionOrresetMode());
            edtion.setUpdateValue(vo.getEjectionOrresetMode());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getMoldLength()
                && !vo.getMoldLength().equals(one.getMoldLength())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldLength");
            edtion.setKeyValue("模具尺寸长（预估）");
            edtion.setBaseValue(one.getMoldLength());
            edtion.setUpdateValue(vo.getMoldLength());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getMoldWidth()
                && !vo.getMoldWidth().equals(one.getMoldWidth())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldWidth");
            edtion.setKeyValue("模具尺寸宽（预估）");
            edtion.setBaseValue(one.getMoldWidth());
            edtion.setUpdateValue(vo.getMoldWidth());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getMoldHeight()
                && !vo.getMoldHeight().equals(one.getMoldHeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldHeight");
            edtion.setKeyValue("模具尺寸高（预估）");
            edtion.setBaseValue(one.getMoldHeight());
            edtion.setUpdateValue(vo.getMoldHeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getMoldType()
                && !vo.getMoldType().equals(one.getMoldType())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldType");
            edtion.setKeyValue("模具类型");
            edtion.setBaseValue(one.getMoldType());
            edtion.setUpdateValue(vo.getMoldType());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getTargetCount()
                && !vo.getTargetCount().equals(one.getTargetCount())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("targetCount");
            edtion.setKeyValue("目标次数");
            edtion.setBaseValue(one.getTargetCount());
            edtion.setUpdateValue(vo.getTargetCount());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getBakingMaterialsRequirements()
                && !vo.getBakingMaterialsRequirements().equals(one.getBakingMaterialsRequirements())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("bakingMaterialsRequirements");
            edtion.setKeyValue("烘料要求");
            edtion.setBaseValue(one.getBakingMaterialsRequirements());
            edtion.setUpdateValue(vo.getBakingMaterialsRequirements());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getDingmoWeight()
                && !vo.getDingmoWeight().equals(one.getDingmoWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("dingmoWeight");
            edtion.setKeyValue("模具定模重量");
            edtion.setBaseValue(one.getDingmoWeight());
            edtion.setUpdateValue(vo.getDingmoWeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getDongmoWeight()
                && !vo.getDongmoWeight().equals(one.getDongmoWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("dongmoWeight");
            edtion.setKeyValue("模具动模重量");
            edtion.setBaseValue(one.getDongmoWeight());
            edtion.setUpdateValue(vo.getDongmoWeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != vo.getMoldActionPrecautions()
                && !vo.getMoldActionPrecautions().equals(one.getMoldActionPrecautions())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(vo.getMoldId());
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldActionPrecautions");
            edtion.setKeyValue("模具动作注意事项");
            edtion.setBaseValue(one.getMoldActionPrecautions());
            edtion.setUpdateValue(vo.getMoldActionPrecautions());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        return list;
    }

    public static List<Edtion> updateMoldPlanMain(TestModelMainTable testModelMainTable,
                                                  String planName,
                                                  String serialNumber,
                                                  String baseVersion,
                                                  String version,
                                                  String userId) {
        List<Edtion> list = Lists.newArrayList();
        if (StringUtils.isNotBlank(planName)
                && !testModelMainTable.getPlanName().equals(planName)) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(testModelMainTable.getId());
            edtion.setEdition("V" + (testModelMainTable.getEdition() + 1));
            edtion.setKeyName("planName");
            edtion.setKeyValue("试模计划表名称");
            edtion.setBaseValue(testModelMainTable.getPlanName());
            edtion.setUpdateValue(planName);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(serialNumber)
                && !testModelMainTable.getSerialNumber().equals(serialNumber)) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(testModelMainTable.getId());
            edtion.setEdition("V" + (testModelMainTable.getEdition() + 1));
            edtion.setKeyName("serialNumber");
            edtion.setKeyValue("试模计划表编号");
            edtion.setBaseValue(testModelMainTable.getSerialNumber());
            edtion.setUpdateValue(serialNumber);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(version)
                && !testModelMainTable.getVersion().equals(version)) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(testModelMainTable.getId());
            edtion.setEdition("V" + (testModelMainTable.getEdition() + 1));
            edtion.setKeyName("version");
            edtion.setKeyValue("试模计划表版本");
            edtion.setBaseValue(baseVersion);
            edtion.setUpdateValue(version);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        return list;
    }

    public static List<Edtion> verityTestMoldSubTable(
            TestModelSubTable old,
            TestModelSubTable newData,
            Integer version,
            String userId,
            String oldDevice,
            String newDevice,
            String oldTarget,
            String newTarget
    ) {
        List<Edtion> list = Lists.newArrayList();
        if (StringUtils.isNotBlank(newData.getMoldId()) && !newData.getMoldId().equals(old.getMoldId())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("moldId");
            edtion.setKeyValue("模具编号");
            edtion.setBaseValue(old.getMoldId());
            edtion.setUpdateValue(newData.getMoldId());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getMoldName()) && !newData.getMoldName().equals(old.getMoldName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("moldName");
            edtion.setKeyValue("模具名称");
            edtion.setBaseValue(old.getMoldName());
            edtion.setUpdateValue(newData.getMoldName());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getCustomerName()) && !newData.getCustomerName().equals(old.getCustomerName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("customerName");
            edtion.setKeyValue("客户");
            edtion.setBaseValue(old.getCustomerName());
            edtion.setUpdateValue(newData.getCustomerName());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getTongmanName()) && !newData.getTongmanName().equals(old.getTongmanName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("tongmanName");
            edtion.setKeyValue("钳工");
            edtion.setBaseValue(old.getTongmanName());
            edtion.setUpdateValue(newData.getTongmanName());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getMaterialName()) && !newData.getMaterialName().equals(old.getMaterialName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("materialName");
            edtion.setKeyValue("材料名称");
            edtion.setBaseValue(old.getMaterialName());
            edtion.setUpdateValue(newData.getMaterialName());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getMaterialWeight()) && !newData.getMaterialWeight().equals(old.getMaterialWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("materialWeight");
            edtion.setKeyValue("材料重量");
            edtion.setBaseValue(old.getMaterialWeight());
            edtion.setUpdateValue(newData.getMaterialWeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getProjectManagerId()) && !newData.getProjectManagerId().equals(old.getProjectManagerId())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("projectManagerId");
            edtion.setKeyValue("主要联络人");
            edtion.setBaseValue(old.getProjectManagerId());
            edtion.setUpdateValue(newData.getProjectManagerId());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != newData.getPlannedTime()) {
            String format = DateUtil.format(newData.getPlannedTime(), "yyyy-MM-dd");
            String format1 = DateUtil.format(old.getPlannedTime(), "yyyy-MM-dd");
            if (!format.equals(format1)) {
                Edtion edtion = new Edtion();
                edtion.setRed_id(newData.getParentPlanId());
                edtion.setEdition("V" + (version + 1));
                edtion.setKeyName("plannedTime");
                edtion.setKeyValue("预计试模时间");
                edtion.setBaseValue(format1);
                edtion.setUpdateValue(format);
                edtion.setPerson(userId);
                list.add(edtion);
            }
        }
        if (StringUtils.isNotBlank(newDevice)) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("moldTestingDevice");
            edtion.setKeyValue("试模设备");
            edtion.setBaseValue(oldDevice);
            edtion.setUpdateValue(newDevice);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getTryOutTimes()) && !newData.getTryOutTimes().equals("T" + old.getTryOutTimes())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("tryOutTimes");
            edtion.setKeyValue("试模次数");
            edtion.setBaseValue("T" + old.getTryOutTimes());
            edtion.setUpdateValue(newData.getTryOutTimes());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != newData.getTryOutDeviceCount() && !newData.getTryOutDeviceCount().equals(old.getTryOutDeviceCount())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("tryOutDeviceCount");
            edtion.setKeyValue("试模件数");
            edtion.setBaseValue(old.getTryOutDeviceCount() == null ? null : old.getTryOutDeviceCount().toString());
            edtion.setUpdateValue(newData.getTryOutDeviceCount().toString());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getRemark()) && !newData.getRemark().equals(old.getRemark())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("remark");
            edtion.setKeyValue("备注");
            edtion.setBaseValue(old.getRemark());
            edtion.setUpdateValue(newData.getRemark());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getProjectName()) && !newData.getProjectName().equals(old.getProjectName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("projectName");
            edtion.setKeyValue("项目名称");
            edtion.setBaseValue(old.getProjectName());
            edtion.setUpdateValue(newData.getProjectName());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getBakingMaterialsRequirements()) && !newData.getBakingMaterialsRequirements().equals(old.getBakingMaterialsRequirements())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("bakingMaterialsRequirements");
            edtion.setKeyValue("烘料要求");
            edtion.setBaseValue(old.getBakingMaterialsRequirements());
            edtion.setUpdateValue(newData.getBakingMaterialsRequirements());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getPrice()) && !newData.getPrice().equals(old.getPrice())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("price");
            edtion.setKeyValue("试模台时费");
            edtion.setBaseValue(old.getPrice());
            edtion.setUpdateValue(newData.getPrice());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getTryOutAddress()) && !newData.getTryOutAddress().equals(old.getTryOutAddress())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("tryOutAddress");
            edtion.setKeyValue("模具试模地址");
            edtion.setBaseValue(old.getTryOutAddress());
            edtion.setUpdateValue(newData.getTryOutAddress());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getDingmoWeight()) && !newData.getDingmoWeight().equals(old.getDingmoWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("dingmoWeight");
            edtion.setKeyValue("模具定模重量");
            edtion.setBaseValue(old.getDingmoWeight());
            edtion.setUpdateValue(newData.getDingmoWeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getDongmoWeight()) && !newData.getDongmoWeight().equals(old.getDongmoWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("dongmoWeight");
            edtion.setKeyValue("模具动模重量");
            edtion.setBaseValue(old.getDongmoWeight());
            edtion.setUpdateValue(newData.getDongmoWeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newData.getMoldActionPrecautions())
                && !newData.getMoldActionPrecautions().equals(old.getMoldActionPrecautions())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("moldActionPrecautions");
            edtion.setKeyValue("模具动作注意事项");
            edtion.setBaseValue(old.getMoldActionPrecautions());
            edtion.setUpdateValue(newData.getMoldActionPrecautions());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(newTarget)) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(newData.getParentPlanId());
            edtion.setEdition("V" + (version + 1));
            edtion.setKeyName("targetId");
            edtion.setKeyValue("试模目的");
            edtion.setBaseValue(oldTarget);
            edtion.setUpdateValue(newTarget);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        return list;
    }

    public static List<Edtion> verityNoticeMainTabale(
            String moldId,
            String moldName,
            String moldLook,
            String pourTime,
            String temperatureControlTime,
            String needHydraumaticStation,
            String injectionMoldingTime,
            String hasLimitSwitch,
            String hotSpotPairType,
            String hasTimeRelay,
            String materials,
            String moldCount,
            String color,
            String materialsCount,
            String samplePieceWeight,
            String moldWeight,
            String tongmanName,
            String tryOutTimes,
            String plannedTime,
            String noticeId,
            Integer version,
            String userId,
            TestModelSubTable subTable,
            int vs
    ) {
        List<Edtion> list = Lists.newArrayList();
        if (null != moldId && !moldId.equals(subTable.getMoldId())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldId");
            edtion.setKeyValue("模具编号");
            edtion.setBaseValue(subTable.getMoldId());
            edtion.setUpdateValue(moldId);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != moldName && !moldName.equals(subTable.getMoldName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldName");
            edtion.setKeyValue("模具名称");
            edtion.setBaseValue(subTable.getMoldName());
            edtion.setUpdateValue(moldName);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != moldLook && !moldLook.equals(subTable.getMoldLook())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldLook");
            edtion.setKeyValue("模具外形");
            edtion.setBaseValue(subTable.getMoldLook());
            edtion.setUpdateValue(moldLook);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != pourTime && !pourTime.equals(subTable.getPourTime())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("pourTime");
            edtion.setKeyValue("几点浇注");
            edtion.setBaseValue(subTable.getPourTime());
            edtion.setUpdateValue(pourTime);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != temperatureControlTime && !temperatureControlTime.equals(subTable.getTemperatureControlTime())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("temperatureControlTime");
            edtion.setKeyValue("几点温控（注明接口）");
            edtion.setBaseValue(subTable.getTemperatureControlTime());
            edtion.setUpdateValue(temperatureControlTime);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != needHydraumaticStation && !needHydraumaticStation.equals(subTable.getNeedHydraumaticStation())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("needHydraumaticStation");
            edtion.setKeyValue("是否需要液压工作站");
            edtion.setBaseValue(subTable.getNeedHydraumaticStation());
            edtion.setUpdateValue(needHydraumaticStation);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != injectionMoldingTime && !injectionMoldingTime.equals(subTable.getInjectionMoldingTime())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("injectionMoldingTime");
            edtion.setKeyValue("几点顺序注塑");
            edtion.setBaseValue(subTable.getInjectionMoldingTime());
            edtion.setUpdateValue(injectionMoldingTime);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != hasLimitSwitch && !hasLimitSwitch.equals(subTable.getHasLimitSwitch())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("hasLimitSwitch");
            edtion.setKeyValue("是否有限位开关");
            edtion.setBaseValue(subTable.getHasLimitSwitch());
            edtion.setUpdateValue(hasLimitSwitch);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != hotSpotPairType && !hotSpotPairType.equals(subTable.getHotSpotPairType())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("hotSpotPairType");
            edtion.setKeyValue("热点偶型号");
            edtion.setBaseValue(subTable.getHotSpotPairType());
            edtion.setUpdateValue(hotSpotPairType);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != hasTimeRelay && !hasTimeRelay.equals(subTable.getHasTimeRelay())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("hasTimeRelay");
            edtion.setKeyValue("是否有时间继电器");
            edtion.setBaseValue(subTable.getHasTimeRelay());
            edtion.setUpdateValue(hasTimeRelay);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != materials && !materials.equals(subTable.getMaterials())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("materials");
            edtion.setKeyValue("制件材料");
            edtion.setBaseValue(subTable.getMaterials());
            edtion.setUpdateValue(materials);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != moldCount && !moldCount.equals(subTable.getMoldCount())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldCount");
            edtion.setKeyValue("试模件数");
            edtion.setBaseValue(subTable.getMoldCount());
            edtion.setUpdateValue(moldCount);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != color && !color.equals(subTable.getColor())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("color");
            edtion.setKeyValue("制件颜色");
            edtion.setBaseValue(subTable.getColor());
            edtion.setUpdateValue(color);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != materialsCount && !materialsCount.equals(subTable.getMaterialsCount())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("materialsCount");
            edtion.setKeyValue("材料重量");
            edtion.setBaseValue(subTable.getMaterialsCount());
            edtion.setUpdateValue(materialsCount);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != samplePieceWeight && !samplePieceWeight.equals(subTable.getSamplePieceWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("samplePieceWeight");
            edtion.setKeyValue("样件重量");
            edtion.setBaseValue(subTable.getSamplePieceWeight());
            edtion.setUpdateValue(samplePieceWeight);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != moldWeight && !moldWeight.equals(subTable.getMoldWeight())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("moldWeight");
            edtion.setKeyValue("模具重量");
            edtion.setBaseValue(subTable.getMoldWeight());
            edtion.setUpdateValue(moldWeight);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != tongmanName && !tongmanName.equals(subTable.getTongmanName())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("tongmanName");
            edtion.setKeyValue("钳工组长");
            edtion.setBaseValue(subTable.getTongmanName());
            edtion.setUpdateValue(tongmanName);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != tryOutTimes && !tryOutTimes.equals("T" + subTable.getTryOutTimes())) {
            Edtion edtion = new Edtion();
            edtion.setRed_id(noticeId);
            edtion.setEdition("V" + vs);
            edtion.setKeyName("tryOutTimes");
            edtion.setKeyValue("试模次数");
            edtion.setBaseValue("T" + subTable.getTryOutTimes());
            edtion.setUpdateValue(tryOutTimes);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(plannedTime)) {
            String format = DateUtil.format(MyUtils.stringToDate(plannedTime), "yyyy-MM-dd");
            if (!format.equals(DateUtil.format(subTable.getPlannedTime(), "yyyy-MM-dd"))) {
                Edtion edtion = new Edtion();
                edtion.setRed_id(noticeId);
                edtion.setEdition("V" + vs);
                edtion.setKeyName("plannedTime");
                edtion.setKeyValue("计划试模时间");
                edtion.setBaseValue(DateUtil.format(subTable.getPlannedTime(), "yyyy-MM-dd"));
                edtion.setUpdateValue(format);
                edtion.setPerson(userId);
                list.add(edtion);
            }
        }
        return list;
    }

    public static List<EdtionNotice> veriryTestNoticeMain(
            String nodeId,
            Integer version,
            String userId,
            String projectName,
            String reportName,
            List<String> tryOutTypeId,
            List<String> tryOutCompanyId,
            List<String> tryOutDeviceId,
            List<String> versionId,
            String tryOutTimes,
            String tryOutTimesUpdate,
            TestNoticeMainTabale mainTabale
    ) {
        List<EdtionNotice> list = Lists.newArrayList();
        if (StringUtils.isNotBlank(projectName) && !projectName.equals(mainTabale.getProjectName())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("projectName");
            edtion.setKeyValue("项目名称");
            edtion.setBaseValue(mainTabale.getProjectName());
            edtion.setUpdateValue(projectName);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(reportName) && !reportName.equals(mainTabale.getReportName())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("reportName");
            edtion.setKeyValue("试模报告单名称");
            edtion.setBaseValue(mainTabale.getReportName());
            edtion.setUpdateValue(reportName);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != tryOutTypeId) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("tryOutTypeId");
            edtion.setKeyValue("试模类型");
            edtion.setBaseValue(tryOutTypeId.get(0));
            edtion.setUpdateValue(tryOutTypeId.get(1));
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != tryOutCompanyId) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("tryOutCompanyId");
            edtion.setKeyValue("试模单位");
            edtion.setBaseValue(tryOutCompanyId.get(0));
            edtion.setUpdateValue(tryOutCompanyId.get(1));
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != tryOutDeviceId) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("tryOutDeviceId");
            edtion.setKeyValue("试模设备");
            edtion.setBaseValue(tryOutDeviceId.get(0));
            edtion.setUpdateValue(tryOutDeviceId.get(1));
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (null != versionId) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("versionId");
            edtion.setKeyValue("版本号");
            edtion.setBaseValue(versionId.get(0));
            edtion.setUpdateValue(versionId.get(1));
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (StringUtils.isNotBlank(tryOutTimesUpdate) && !tryOutTimesUpdate.equals(tryOutTimes)) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("tryOutTimes");
            edtion.setKeyValue("试模次数");
            edtion.setBaseValue(tryOutTimes);
            edtion.setUpdateValue(tryOutTimesUpdate);
            edtion.setPerson(userId);
            list.add(edtion);
        }
        return list;
    }

    public static List<EdtionNotice> veriryException(
            String nodeId,
            Integer version,
            String userId,
            TestNoticeExceptionTimeTable oldException,
            TestNoticeExceptionTimeTable newException) {
        List<EdtionNotice> list = Lists.newArrayList();
        if (!newException.getTimeFrame().equals(oldException.getTimeFrame())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("exceptionPeriod");
            edtion.setKeyValue("开始~结束时间段");
            edtion.setBaseValue(oldException.getTimeFrame());
            edtion.setUpdateValue(newException.getTimeFrame());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newException.getTimes().equals(oldException.getTimes())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("exceptionHour");
            edtion.setKeyValue("时间");
            edtion.setBaseValue(oldException.getTimes());
            edtion.setUpdateValue(newException.getTimes());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newException.getWaitContent().equals(oldException.getWaitContent())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("waitDetailContent");
            edtion.setKeyValue("等待详细内容");
            edtion.setBaseValue(oldException.getWaitContent());
            edtion.setUpdateValue(newException.getWaitContent());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newException.getRepairContent().equals(oldException.getRepairContent())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("fixDetialContent");
            edtion.setKeyValue("修模详细内容");
            edtion.setBaseValue(oldException.getRepairContent());
            edtion.setUpdateValue(newException.getRepairContent());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newException.getFaultContent().equals(oldException.getFaultContent())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("breakdownDetialContent");
            edtion.setKeyValue("设备故障内容");
            edtion.setBaseValue(oldException.getFaultContent());
            edtion.setUpdateValue(newException.getFaultContent());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newException.getRemark().equals(oldException.getRemark())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("exceptionRemark");
            edtion.setKeyValue("备注");
            edtion.setBaseValue(oldException.getRemark());
            edtion.setUpdateValue(newException.getRemark());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        return list;
    }

    public static List<EdtionNotice> veriryProduction(
            String nodeId,
            Integer version,
            String userId,
            TestNoticeProductionTypeTable oldProduction,
            TestNoticeProductionTypeTable newProduction) {
        List<EdtionNotice> list = Lists.newArrayList();
        if (!newProduction.getModulusQuantity().equals(oldProduction.getModulusQuantity())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("debugMoldCount");
            edtion.setKeyValue("调试模数");
            edtion.setBaseValue(oldProduction.getModulusQuantity());
            edtion.setUpdateValue(newProduction.getModulusQuantity());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newProduction.getProductionQuantity().equals(oldProduction.getProductionQuantity())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("produceMoldCount");
            edtion.setKeyValue("生产模数");
            edtion.setBaseValue(oldProduction.getProductionQuantity());
            edtion.setUpdateValue(newProduction.getProductionQuantity());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newProduction.getQualifiedQuantity().equals(oldProduction.getQualifiedQuantity())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("qualifiedMoldCount");
            edtion.setKeyValue("合格品数");
            edtion.setBaseValue(oldProduction.getQualifiedQuantity());
            edtion.setUpdateValue(newProduction.getQualifiedQuantity());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newProduction.getReceiveQuantity().equals(oldProduction.getReceiveQuantity())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("concessionalReceivingCount");
            edtion.setKeyValue("让步接收数");
            edtion.setBaseValue(oldProduction.getReceiveQuantity());
            edtion.setUpdateValue(newProduction.getReceiveQuantity());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newProduction.getMoldNumber().equals(oldProduction.getMoldNumber())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("perCount");
            edtion.setKeyValue("每模件数");
            edtion.setBaseValue(oldProduction.getMoldNumber());
            edtion.setUpdateValue(newProduction.getMoldNumber());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newProduction.getModelWeight().equals(oldProduction.getModelWeight())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("moldWeight");
            edtion.setKeyValue("单模重量");
            edtion.setBaseValue(oldProduction.getModelWeight());
            edtion.setUpdateValue(newProduction.getModelWeight());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        if (!newProduction.getProductionBeat().equals(oldProduction.getProductionBeat())) {
            EdtionNotice edtion = new EdtionNotice();
            edtion.setRed_id(nodeId);
            edtion.setEdition("V" + version);
            edtion.setKeyName("productionTakt");
            edtion.setKeyValue("生产节拍");
            edtion.setBaseValue(oldProduction.getProductionBeat());
            edtion.setUpdateValue(newProduction.getProductionBeat());
            edtion.setPerson(userId);
            list.add(edtion);
        }
        return list;
    }

    public static List<EdtionNotice> veriryConsumable(
            String nodeId,
            Integer version,
            String userId,
            TestNoticeConsumableTable oldConsumable,
            TestNoticeConsumableTable newConsumable) {
        List<EdtionNotice> list = Lists.newArrayList();
        if (ObjectUtil.isNotEmpty(oldConsumable)) {

            if(Objects.isNull(newConsumable)){
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + (version));
                edtion.setKeyValue("删除");
                edtion.setUpdateValue(oldConsumable.toString());
                edtion.setPerson(userId);
                list.add(edtion);
                return list;
            }

            if (!newConsumable.getSpecification().equals(oldConsumable.getSpecification())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("materialSpec");
                edtion.setKeyValue("规格");
                edtion.setBaseValue(oldConsumable.getSpecification());
                edtion.setUpdateValue(newConsumable.getSpecification());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newConsumable.getClaim().equals(oldConsumable.getClaim())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("materialReceiveCount");
                edtion.setKeyValue("领用数");
                edtion.setBaseValue(oldConsumable.getClaim());
                edtion.setUpdateValue(newConsumable.getClaim());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newConsumable.getStock().equals(oldConsumable.getStock())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("materialReturnCount");
                edtion.setKeyValue("退库数");
                edtion.setBaseValue(oldConsumable.getStock());
                edtion.setUpdateValue(newConsumable.getStock());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newConsumable.getConsumption().equals(oldConsumable.getConsumption())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("materialConsumeCount");
                edtion.setKeyValue("消耗数");
                edtion.setBaseValue(oldConsumable.getConsumption());
                edtion.setUpdateValue(newConsumable.getConsumption());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newConsumable.getDescription().equals(oldConsumable.getDescription())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("materialExceptionCount");
                edtion.setKeyValue("异常说明");
                edtion.setBaseValue(oldConsumable.getDescription());
                edtion.setUpdateValue(newConsumable.getDescription());
                edtion.setPerson(userId);
                list.add(edtion);
            }
        } else {
            String toString = newConsumable.toString();
            if (StringUtils.isNotBlank(toString)) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + (version));
                edtion.setKeyValue("新增");
                edtion.setUpdateValue(newConsumable.toString());
                edtion.setPerson(userId);
                list.add(edtion);
            }
        }
        return list;
    }

    public static void verityConsumable(
            String nodeId,
            Integer version,
            String userId,
            TestNoticeProductionProcessTable oldProcessTable,
            TestNoticeProductionProcessTable newProcessTable,
            List<EdtionNotice> list) {
        if (ObjectUtil.isNotEmpty(oldProcessTable)) {
            if (!newProcessTable.getMaterialName().equals(oldProcessTable.getMaterialName())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("materialName");
                edtion.setKeyValue("材料名称/牌号");
                edtion.setBaseValue(oldProcessTable.getMaterialName());
                edtion.setUpdateValue(newProcessTable.getMaterialName());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newProcessTable.getBakingTemperature().equals(oldProcessTable.getBakingTemperature())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("dryingTemperature");
                edtion.setKeyValue("烘料温度");
                edtion.setBaseValue(oldProcessTable.getBakingTemperature());
                edtion.setUpdateValue(newProcessTable.getBakingTemperature());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newProcessTable.getBakingTime().equals(oldProcessTable.getBakingTime())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("dryingTime");
                edtion.setKeyValue("烘料时间");
                edtion.setBaseValue(oldProcessTable.getBakingTime());
                edtion.setUpdateValue(newProcessTable.getBakingTime());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newProcessTable.getEndPosition().equals(oldProcessTable.getEndPosition())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("storageEndPoint");
                edtion.setKeyValue("储料终点位置");
                edtion.setBaseValue(oldProcessTable.getEndPosition());
                edtion.setUpdateValue(newProcessTable.getEndPosition());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newProcessTable.getHoldingTime().equals(oldProcessTable.getHoldingTime())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("dwellTime");
                edtion.setKeyValue("保压时间");
                edtion.setBaseValue(oldProcessTable.getHoldingTime());
                edtion.setUpdateValue(newProcessTable.getHoldingTime());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newProcessTable.getHoldingPressure().equals(oldProcessTable.getHoldingPressure())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("dwellPressure");
                edtion.setKeyValue("保压压力");
                edtion.setBaseValue(oldProcessTable.getHoldingPressure());
                edtion.setUpdateValue(newProcessTable.getHoldingPressure());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newProcessTable.getHoldingSpeed().equals(oldProcessTable.getHoldingSpeed())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("dwellSpeed");
                edtion.setKeyValue("保压速度");
                edtion.setBaseValue(oldProcessTable.getHoldingSpeed());
                edtion.setUpdateValue(newProcessTable.getHoldingSpeed());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newProcessTable.getCoolingTime().equals(oldProcessTable.getCoolingTime())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("collingTime");
                edtion.setKeyValue("冷却时间");
                edtion.setBaseValue(oldProcessTable.getCoolingTime());
                edtion.setUpdateValue(newProcessTable.getCoolingTime());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newProcessTable.getMoldTemperature().equals(oldProcessTable.getMoldTemperature())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("moldTemperature");
                edtion.setKeyValue("模温");
                edtion.setBaseValue(oldProcessTable.getMoldTemperature());
                edtion.setUpdateValue(newProcessTable.getMoldTemperature());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (!newProcessTable.getHeatedTemperature().equals(oldProcessTable.getHeatedTemperature())) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("hotRunnerTemperature");
                edtion.setKeyValue("热流道温度");
                edtion.setBaseValue(oldProcessTable.getHeatedTemperature());
                edtion.setUpdateValue(newProcessTable.getHeatedTemperature());
                edtion.setPerson(userId);
                list.add(edtion);
            }
            veritySprue(nodeId, version, userId, JSONArray.parseArray(oldProcessTable.getSprue()), JSONArray.parseArray(newProcessTable.getSprue()), list);
            verityScrewTemperature(nodeId, version, userId, JSONArray.parseArray(oldProcessTable.getScrewTemperature()), JSONArray.parseArray(newProcessTable.getScrewTemperature()), list);
            veritySprueFeedingMethod(nodeId, version, userId, JSONArray.parseArray(oldProcessTable.getSprueFeedingMethod()), JSONArray.parseArray(newProcessTable.getSprueFeedingMethod()), list);
        } else {
            String toString = newProcessTable.toString();
            if (StringUtils.isNotBlank(toString)) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + (version));
                edtion.setKeyValue("新增");
                edtion.setUpdateValue(newProcessTable.toString());
                edtion.setPerson(userId);
                list.add(edtion);
            }
        }
    }

    private static void veritySprue(String nodeId,
                                    Integer version,
                                    String userId,
                                    JSONArray oldSprue,
                                    JSONArray newSprue,
                                    List<EdtionNotice> list) {
        for (int i = 0; i < oldSprue.size(); i++) {
            JSONObject object = oldSprue.getJSONObject(i);
            JSONObject object1 = newSprue.getJSONObject(i);
            if (null != object1.getString("ejectionTempresure")
                    && !object1.getString("ejectionTempresure").equals(object.getString("ejectionTempresure"))) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("ejectionTempresure");
                edtion.setKeyValue("射胶参数-第" + (i + 1) + "段-压力");
                edtion.setBaseValue(object.getString("ejectionTempresure"));
                edtion.setUpdateValue(object1.getString("ejectionTempresure"));
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (null != object1.getString("ejectionposition")
                    && !object1.getString("ejectionposition").equals(object.getString("ejectionposition"))) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("ejectionposition");
                edtion.setKeyValue("射胶参数-第" + (i + 1) + "段-位置");
                edtion.setBaseValue(object.getString("ejectionposition"));
                edtion.setUpdateValue(object1.getString("ejectionposition"));
                edtion.setPerson(userId);
                list.add(edtion);
            }
            if (null != object1.getString("ejectionSpeed")
                    && !object1.getString("ejectionSpeed").equals(object.getString("ejectionSpeed"))) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("ejectionSpeed");
                edtion.setKeyValue("射胶参数-第" + (i + 1) + "段-速度");
                edtion.setBaseValue(object.getString("ejectionSpeed"));
                edtion.setUpdateValue(object1.getString("ejectionSpeed"));
                edtion.setPerson(userId);
                list.add(edtion);
            }
        }
    }

    private static void verityScrewTemperature(String nodeId,
                                               Integer version,
                                               String userId,
                                               JSONArray oldScrewTemperature,
                                               JSONArray newScrewTemperature,
                                               List<EdtionNotice> list) {
        for (int i = 0; i < oldScrewTemperature.size(); i++) {
            JSONObject object = oldScrewTemperature.getJSONObject(i);
            JSONObject object1 = newScrewTemperature.getJSONObject(i);
            if (null != object1.getString("temperatureValue")
                    && !object1.getString("temperatureValue").equals(object.getString("temperatureValue"))) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("temperatureValue");
                edtion.setKeyValue("螺杆温度-第" + (i + 1) + "段");
                edtion.setBaseValue(object.getString("temperatureValue"));
                edtion.setUpdateValue(object1.getString("temperatureValue"));
                edtion.setPerson(userId);
                list.add(edtion);
            }
        }
    }

    private static void veritySprueFeedingMethod(String nodeId,
                                                 Integer version,
                                                 String userId,
                                                 JSONArray oldSprueFeedingMethod,
                                                 JSONArray newSprueFeedingMethod,
                                                 List<EdtionNotice> list) {
        for (int i = 0; i < oldSprueFeedingMethod.size(); i++) {
            JSONObject object = oldSprueFeedingMethod.getJSONObject(i);
            JSONObject object1 = newSprueFeedingMethod.getJSONObject(i);
            if (null != object1.getString("gluingmethod")
                    && !object1.getString("gluingmethod").equals(object.getString("gluingmethod"))) {
                EdtionNotice edtion = new EdtionNotice();
                edtion.setRed_id(nodeId);
                edtion.setEdition("V" + version);
                edtion.setKeyName("gluingmethod");
                edtion.setKeyValue("顺序阀进胶方式-" + (i + 1) + "");
                edtion.setBaseValue(object.getString("gluingmethod"));
                edtion.setUpdateValue(object1.getString("gluingmethod"));
                edtion.setPerson(userId);
                list.add(edtion);
            }
        }
    }

}
